﻿@model RegisterEditModel
@{
    ViewData["Title"] = new string[] { "邮箱注册" };
}
<!--微信第三方登录js-->
<script src="http://res.wx.qq.com/connect/zh_CN/htmledition/js/wxLogin.js"></script>
@{
    var codeError = TempData.Get<string>("codeError", string.Empty);
    var SiteName = ViewData.Get<string>("SiteName", string.Empty);
    var registerType = ViewData.Get<RegisterType>("RegisterType", RegisterType.MobileOrEmail);
    var accountTypes = ViewData.Get<IEnumerable<AccountType>>("accountTypes", null);
}

<div class="jh-login-home">
    <h1 class="tn-mb-50">欢迎加入@(SiteName)</h1>
    <div class="row">
        <div class="col-xs-8" style="@(Utility.CheckThirdPartyLogin()?"padding-right:150px;border-right:1px solid #ddd;":"padding-right:100px") ">
            @using (Html.BeginForm("EmailRegister", "Account", FormMethod.Post, new { @id = "RegisterForm", @class = "form-horizontal tn-form-validation  " }))
            {
                <div class="form-group">
                    @Html.LabelFor(n => n.AccountEmail)
                    @Html.TextBoxFor(n => n.AccountEmail, new { @class = "form-control" })
                    @Html.ValidationMessageFor(n => n.AccountEmail)
                    @if (registerType != RegisterType.Email)
                    {
                        <span class="help-block tn-mb-0">或使用<a href="@SiteUrls.Instance().Register(false)" class="a tn-ml-5">手机注册</a></span>
                    }
                </div>
                <div class="form-group" id="passwordLoad">
                    @Html.Action("_PassWordPoclaimed", "Account", new { passWordTitle = "密码" })
                    <span style="top:25px" class="glyphicon  form-control-feedback" aria-hidden="true"><i class="fa fa-eye-slash"></i></span>
                    <input class="tn-click-eye" type="button" />
                    @Html.ValidationMessageFor(n => n.PassWord)
                    <span class="help-block tn-mb-0">字母、数字至少6位</span>
                </div>
                //验证码
                var mathBuildInfoModel = new ViewDataDictionary();
                mathBuildInfoModel.Add("InputText", "换一换");
                mathBuildInfoModel.Add("ErrorMessage", codeError);
                mathBuildInfoModel.Add("RequiredMessage", "请输入正确验证码");
                mathBuildInfoModel.Add("IsRequired", true);
                mathBuildInfoModel.Add("Title", "验证码");
                @Html.Captcha(4, "_DefaultCaptchaView", mathBuildInfoModel).AsIntelligent()
                <div class="form-group">
                    <div class="checkbox">
                        <label>
                            <input style="margin-top:6px" id="isPass" type="checkbox"><small> 我已看过并完全同意 <a href="javascript:;" onclick="" class="a tn-ml-5 layerprovision">《用户使用协议》</a> </small>
                        </label>
                    </div>
                </div>
                <div class="form-group">
                    <button type="submit" class="btn btn-primary tn-btn-wm">注册</button>
                </div>
            }
        </div>
        @if (Utility.CheckThirdPartyLogin())
        {
        <div class="col-xs-4" style="padding-left:30px;">
            <p>已有帐号？<a href="@SiteUrls.Instance().Login()" class="a tn-ml-5">直接登录 >></a> </p>
            @if (accountTypes != null && accountTypes.Any())
            {
                <p>使用第三方帐号登录</p>
                <ul class="list-inline jh-share-icon">
                    @if (accountTypes.Where(n => n.AccountTypeKey == AccountTypeKeys.Instance().QQ()).Count() > 0)
                    {
                        <li><button class="btn btn-default" onclick="window.location='@SiteUrls.Instance().LoginToThird(AccountTypeKeys.Instance().QQ())'"><i class="fa fa-qq"></i></button></li>
                    }
                    @if (accountTypes.Where(n => n.AccountTypeKey == AccountTypeKeys.Instance().WeChat()).Count() > 0)
                    {
                        <li><button class="btn btn-default layerwechat" ><i class="fa fa-weixin"></i></button></li>
                    }
                </ul>
            }
        </div>
        }

    </div>
</div>
<script>
  require(['jquery','tnlayer'],function($,tnlayer){
     
     $(".layerprovision").click(function(){
         tnlayer.layermodal('注册条款','@CachedUrlHelper.Action("_Provision","Account")','700px','500px')
     })
     $(".layerwechat").click(function(){
         tnlayer.layermodal('微信登录', '@SiteUrls.Instance().LoginToThird(AccountTypeKeys.Instance().WeChat())', '550px', '550px')
     })

    $(".btn-primary").click(function myfunction() {
        $("#RegisterForm").validate();
        if ($("#RegisterForm").valid()) {
            if (!$("#isPass")[0].checked) {
                layer.msg("请先阅读用户使用协议", {
                    icon: 2
                });
                return false;
            }
        }
    })
  })

</script>


